package com.hzy.yiyaoba;

import com.hzy.yiyaoba.utils.CommonUtils;
import com.hzy.yiyaoba.utils.Config;
import com.lidroid.xutils.util.LogUtils;
import com.umeng.analytics.MobclickAgent;

import android.app.Application;

public class MyApplication extends Application {

	@Override
	public void onCreate() {
		super.onCreate();
		initEnvironment();
	}

	private void initEnvironment() {
		initLog();
		initUMeng();
	}

	private void initLog() {
		LogUtils.customTagPrefix = CommonUtils.getAppName(getApplicationContext());
		if (!Config.DEBUG_MODE) {
			LogUtils.allowD = false;
			LogUtils.allowE = false;
			LogUtils.allowI = false;
			LogUtils.allowV = false;
			LogUtils.allowW = false;
			LogUtils.allowWtf = false;
		}
	}

	private void initUMeng() {
		MobclickAgent.setDebugMode(Config.DEBUG_MODE);
		MobclickAgent.setSessionContinueMillis(1000L);
		MobclickAgent.updateOnlineConfig(this);
		MobclickAgent.openActivityDurationTrack(false);
	}
}
